package com.example.android.notepad;

import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.widget.TextView;
import com.example.android.robotium.test.MainActivity;
import com.robotium.solo.Solo;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.ArrayList;

@RunWith(AndroidJUnit4.class)
public class MianActivityTest {

    @Rule
    public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class);
    private Solo solo;

    @Before
    public void setUp(){
        solo = new Solo(InstrumentationRegistry.getInstrumentation(),activityTestRule.getActivity());
    }
    @After
    public void tearDown() throws Exception {
//        solo.finishOpenedActivities();
    }

    @Test
    public void mainActivityTest(){
//        ArrayList<TextView> tvlist = solo.clickInRecyclerView(2,2);
        ArrayList<TextView> tvlist =  solo.clickInList(6);
        Log.i("bototest",tvlist.get(0).getText()+"");
        solo.goBack();

    }

}
